package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.financing.wap.common.CommonConstantUtil.CommonStatus;
import com.financing.wap.dao.IDstHotSearchLogDao;
import com.financing.wap.dto.DstHotSearchLogDTO;
import com.financing.wap.service.IDstHotSearchLogService;
import com.financing.wap.util.DTOdateSetUtil;
/**
 * dst_hot_search_log  
 * 用户搜索记录 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("dstHotSearchLogService")
public class DstHotSearchLogServiceImpl implements IDstHotSearchLogService{

	@Autowired
	private IDstHotSearchLogDao dstHotSearchLogDao;

	@Override
	public int insert(DstHotSearchLogDTO dstHotSearchLog) throws SQLException {
		DTOdateSetUtil.setCreateInfo(dstHotSearchLog);
		DTOdateSetUtil.setUpdateInfo(dstHotSearchLog);
		dstHotSearchLog.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return dstHotSearchLogDao.insert(dstHotSearchLog);
	}

	@Override
	public void update(DstHotSearchLogDTO dstHotSearchLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstHotSearchLog);
		dstHotSearchLogDao.update(dstHotSearchLog);
	}

	@Override
	public void updateForce(DstHotSearchLogDTO dstHotSearchLog) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(dstHotSearchLog);
		dstHotSearchLogDao.updateForce(dstHotSearchLog);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		dstHotSearchLogDao.delete(id);
	}
	
	@Override
	public List<DstHotSearchLogDTO> queryList(DstHotSearchLogDTO dstHotSearchLog) throws SQLException {
		return dstHotSearchLogDao.queryList(dstHotSearchLog);
	}

	@Override
	public int queryListCount(DstHotSearchLogDTO dstHotSearchLog) throws SQLException {
		return dstHotSearchLogDao.queryListCount(dstHotSearchLog);
	}

	@Override
	public DstHotSearchLogDTO loadById(Integer id) throws SQLException {
		return dstHotSearchLogDao.loadById(id);
	}
 	@Override
	public DstHotSearchLogDTO queryListGetFirst(DstHotSearchLogDTO dstHotSearchLog)
			throws SQLException {
		 List<DstHotSearchLogDTO> queryList = queryList(dstHotSearchLog);
		 if(queryList==null||queryList.size()==0){
			 return new DstHotSearchLogDTO();
		 }
		 return queryList.get(0);
	}
}
